package erreAga.dao.toplink;


import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class DatabaseManagerSingletonToplinkImpl {

  private static DatabaseManagerSingletonToplinkImpl instancia;

  private EntityManagerFactory factory;

  private EntityManager manager;

  public EntityManagerFactory getFactory() {
    return factory;
  }

  public EntityManager getManager() {
    return manager;
  }

  public static DatabaseManagerSingletonToplinkImpl getInstancia() {
    if (instancia == null) {
      instancia = new DatabaseManagerSingletonToplinkImpl();
    }
    return instancia;
  }

  private DatabaseManagerSingletonToplinkImpl() {
    factory = Persistence.createEntityManagerFactory("erreAga");
    manager = factory.createEntityManager();
  }

}
